import { assessAnalysisOverviewReleaseMedia } from '@/services/api/api-assess-analysis';
import { ProCard, StatisticCard } from '@ant-design/pro-components';
import { useAccess } from 'umi';
import { Divider } from 'antd';
import React, { useEffect, useState } from 'react';

interface AreaReleaseMediaOverviewProps {
  areaId: string;
  releaseTimes: Array<string>; //季度发布时间范围
}

const AreaReleaseMediaOverview: React.FC<AreaReleaseMediaOverviewProps> = ({
  areaId,
  releaseTimes,
}) => {
  const [responsive, setResponsive] = useState(false);
  const access = useAccess();

  const [overviewReleaseMediaData, setOverviewReleaseMediaDataState] =
    useState<AssessAnalysisData.OverviewReleaseMedia>();

  const loadData = async () => {
    const response = await assessAnalysisOverviewReleaseMedia({
      areaId: areaId,
      releaseTimes: releaseTimes,
    });

    if (response.code == 0) {
      setOverviewReleaseMediaDataState(response.data);
    }
  };

  useEffect(() => {
    loadData();
  }, []);

  return (
    <>
      <ProCard.Group ghost direction={'column'}>
        <ProCard>
          <StatisticCard
            statistic={{
              title: ("发稿总量（篇/得分）"),
              value: overviewReleaseMediaData?.releaseMediaCount,
              suffix: `/ 暂未计算分值`
            }}

          />
        </ProCard>
        <Divider type={responsive ? 'horizontal' : 'vertical'} />
        <ProCard>
          <StatisticCard
            statistic={{
              title: ("中央媒体（篇/得分）"),
              value: overviewReleaseMediaData?.releaseCentreMediaCount,
              suffix: `/ 暂未计算分值`
            }}

          />
        </ProCard>
        <Divider type={responsive ? 'horizontal' : 'vertical'} />
        <ProCard>
          <StatisticCard
            statistic={{
              title: ("市属媒体（篇/得分）"),
              value: overviewReleaseMediaData?.releaseLocalMediaCount,
              suffix: `/ 暂未计算分值`
            }}

          />
        </ProCard>
      </ProCard.Group>
    </>
  );
};
export default AreaReleaseMediaOverview;
